package com.github


class Diary (val entries : List[Entry]) {

  def next : Diary = new Diary(entries.tail :+ entries.head)
  def prev : Diary = new Diary(entries.last :: entries.init)

  override def toString : String = entries.take(5).map(x => x.getTitle + " (" + x.getDate + ")").mkString("\n")

  def addEntry(entry : Entry) : Diary = new Diary(entry :: entries)
}
